x86/time: prevent overflow with high frequency TSCs
authorNeowutran <xen@neowutran.ovh>
Tue, 20 Dec 2022 12:46:38 +0000 (13:46 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Dec 2022 12:46:38 +0000 (13:46 +0100)
commita7a26da0b59da7233e6c6f63b180bab131398351
tree193f69a6f377ee78c3dfe02531d72787a89a71f0
parent1dcc9b6dfe528c7815a314f9b5581804b5e23750
x86/time: prevent overflow with high frequency TSCs

Make sure tsc_khz is promoted to a 64-bit type before multiplying by
1000 to avoid an 'overflow before widen' bug. Otherwise just above
4.294GHz the value will overflow. Processors with clocks this high are
now in production and require this to work correctly.

Signed-off-by: Neowutran <xen@neowutran.ovh>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: ad15a0a8ca2515d8ac58edfc0bc1d3719219cb77
master date: 2022-12-19 11:34:16 +0100
xen/arch/x86/time.c